<?php
namespace Admin\Controller;
use Think\Controller;

    class UserController extends Controller
    {
        public function index()
        {
           $p = empty($_GET['p'])?'1':$_GET['p'];
           $data =  M('sh_user')->field('id,number,pwd,identity,time')->order(array('id'=>'desc'))->page($p.',5')->select();

                $count = M('sh_user')->count();
                 $page  = new \Think\Page($count,'5');
                 $show = $page->show();

                $this->assign('show',$show);
               $this->assign('data',$data);
                $this->display();
        }

        //添加
          public function add()
        {

            $this->display();

        }

        public function insert()
        {


               $_POST['pwd'] = md5($_POST['pwd']);
              $mm = M('sh_user');
              $mm->create();
              $dd = $mm->add();
              if ($dd > 0) {
                    $this->success('添加成功',U('index'));
              } else {
                     $this->error('添加失败');
              }

        }

        //黑名单
        public function blacklist()
        {
            $this->display();
        }


    }